/**
 * Created by henian.xu on 2018/7/19.
 *
 */

export default {
    namespaced: true,
    modules: {},
    state: {
        // 页面标题/meta等数据
        pageData: {},
    },
    getters: {
        meta(state) {
            const { pageData } = state;
            return pageData.meta || {};
        },
        pageTitle(state, getters) {
            const { meta } = getters;
            return meta.title || document.title;
        },
        pageSubTitle(state, getters) {
            const { meta } = getters;
            return meta.subTitle || '';
        },
    },
    mutations: {
        updatePageData(state, data) {
            state.pageData = {
                ...state.pageData,
                ...data,
            };
        },
    },
    actions: {},
};
